refactor!: migrate class-validator to zod#26597
Conversation
|
Preview environment has been removed. |
There was a problem hiding this comment.
in Zod semantics, .default(x) means “if the input is undefined, substitute x”, so the schema must accept undefined, which effectively makes that value optional-at-input. this causes the generated clients to mark these response properties as optional, but they always do have a value. Thus enforcing the type in ts is fine. All changes in the web commit relate to that.
There was a problem hiding this comment.
additional tests for the feature introduced in #26532 and tests the zod implementation for it
| hideAt: Date | null; | ||
| type: MemoryType; | ||
| data: object; | ||
| data: Record<string, unknown>; |
There was a problem hiding this comment.
no runtime effect, but necessary for types to work out
5f3615e to
d2529af
Compare
6dd4a89 to
68d08fb
Compare
48f6dd9 to
7aad864
Compare
7aad864 to
1df08ce
Compare
60dfcc0 to
803fbfe
Compare
803fbfe to
bec91e9
Compare
caef2b7 to
31c3f2d
Compare
2072dc8 to
182b738
Compare
danieldietzler
left a comment
There was a problem hiding this comment.
This must've been so much work, dang. Thank you!
182b738 to
a2f9bd2
Compare
danieldietzler
left a comment
There was a problem hiding this comment.
Okay, last few notes from my end :)
a2f9bd2 to
8a7cc61
Compare
danieldietzler
left a comment
There was a problem hiding this comment.
Amazing job! Thank you so much for putting all the effort in!
see #26172 for the implementation proposal and #26427 for the first partial migration try.
As discussed, the migration effort is signifcantly lower and less akward when done in one go. This is the PR that does this!
I have iterated over this PR over and over again locally to get this as best as possible. This PR has been separated into 6 commits, one doing the actual server-side migration, one for tiny web, mobile and cli type fixes (unavoidable as explained in my review), the regeneration of the openapi spec/dart and ts clients and the removal of the
class-validatordependency. This approach should help making this reviewable.I tested the whole stack locally, server, web and mobile, going through plenty of views myself to check that it all works and no bugs are introduced. More testing from others is appreciated tho!